import json
from configparser import ConfigParser

cfg = ConfigParser()
cfg.read('mysql.ini')

trans_front = {sec:{k:v for k,v in cfg.items(sec)} for sec,op in cfg.items()}
trans_back = json.dumps(trans_front)
print(trans_back)

<<<<<<< HEAD
import shutil
shutil.copytree()
=======

# 做得不错
>>>>>>> aefc43328259021dc5233f6cd27f1d9e08ca2bb3
